package com.rajaev.dtu.tractor.interfaces.openApi;


import com.rajaev.dtu.tractor.app.service.BatteryService;
import com.rajaev.dtu.tractor.infrastructure.base.errors.BusinessException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 电池标定接口
 */
@RestController
public class BatteryCalibrationController {

    @Autowired
    BatteryService batteryService;

    @GetMapping("/battery/checkVinIsExists")
    public Boolean checkVinIsExists(String vin){
        return batteryService.checkVinIsExists(vin);
    }

    @PostMapping("openApi/battery/save")
    public void calibrationBattery(String vin) throws BusinessException {
        batteryService.save(vin);
    }

    @PostMapping("openApi/battery/delete")
    public void delete(String vin){
        batteryService.delete(vin);
    }

}